	<script type="text/javascript">
		$(document).ready(function(){
			$("#datepicker1").datepicker({
		      dateFormat: "dd/mm/yy",
		      changeMonth: true,
		      changeYear: true
		    });
		});
	</script>
		<div class="row">
		    <div class="col-xs-12">
		        <div class="box box-primary">
		            <div class="box-header">
		                <h3 class="box-title">Tambah Data Klaim Obat & ABHP</h3>
		            </div><!-- /.box-header -->
		            <?php echo form_open('apotik/save', array('role' => 'form', 'id' => 'form'));?>
		            <div class="box-body col-xs-12 col-lg-6">				        
	                    <!-- text input -->
	                    <div class="form-group">
	                        <label>Kode Klaim</label>
	                        <div class="input-group input-group-sm">
	                       		<input class="form-control" name="kd_klaim" id="kd_klaim" type="text" placeholder="Masukkan kode klaim" style="z-index:0;">
	                       		<span class="input-group-btn">
	                       			<a class="btn btn-info btn-flat" href="#" onClick="return kd_peserta()"><i class="fa fa-check"></i></a>
	                       		</span>
	                        </div>
	                    </div>
	                    <div class="form-group">
	                        <label>Dokter</label><br/>
	                       <select class="form-control input-sm dokter" name="dokter" id="dokter" style="width:100%;">
	                       </select>
	                    </div>
		                <div class="form-group">
	                       <label>Unit</label><br/>
	                       <select class="form-control input-sm unit" name="unit" id="unit" style="width:100%;">
	                       </select>
	                    </div>
	                </div>
	                <div class="box-body col-xs-12 col-lg-6">
	                    <div class="form-group">
		                    <label>Tanggal Transaksi</label>
		                    <input class="form-control input-sm" name="tgl_transaksi" id="datepicker1" value="<?= $tgl_transaksi; ?>" type="text" placeholder="Tanggal Transaksi..."> 
		                 	<input name="no" id="no" type="hidden">
		                 </div>
	                    <div class="form-group">
	                        <label>No. DMK</label>
	                       	<input class="form-control input-sm" name="dmk" id="dmk" type="text" placeholder="No. DMK">
	                    </div>
		            </div>
		            <div class="clearfix"></div>
		            <div class="box-body col-xs-12 col-lg-6">
	                    <div class="form-group">
	                        <label>No. Peserta</label>
	                       	<input class="form-control input-sm" name="nopeserta" id="nopeserta" type="text" disabled>
	                    </div>
	                    <div class="form-group">
	                        <label>Nama Peserta</label>
	                       	<input class="form-control input-sm" name="nama" id="nama" type="text" readonly="">
	                    </div>
	                </div>
	                <div class="box-body col-xs-12 col-lg-6">
	                     <div class="form-group">
	                        <label>TTL Peserta</label>
	                       	<input class="form-control input-sm" name="ttl" id="ttl" type="text" disabled>
	                    </div>
	                     <div class="form-group">
	                        <label>Alamat Peserta</label>
	                       	<input class="form-control input-sm" name="alamat" id="alamat" type="text" disabled>
	                    </div>
		            </div>

		            <div class="box-footer col-xs-12">
                         <button type="submit" id="btn" class="btn btn-sm btn-primary btn-flat pull-right" disabled=""><i class="fa fa-floppy-o"></i> Simpan &amp; Lanjutkan</button>
                    </div>

					<?php echo form_close();?>
		            <div class="clearfix"></div>		                   
                    
		        </div><!-- /.box -->                            
		    </div>
		</div>

		<script type="text/javascript">
		$(document).ready(function () {
			$("#master_diagnosa").select2({
			    placeholder: "Pilih Diagnosa"
			});
		});
		</script>
		<script>
		$("#form").validate({
			rules: {
				
				kd_klaim: {
					required: true
				},
			}
		});
		</script>
		<script type="text/javascript">
		  function kd_peserta(){
		    var send_data = {
		        kd_peserta: $("#kd_klaim").val(),
		        <?php echo $this->security->get_csrf_token_name(); ?>: "<?php echo $this->security->get_csrf_hash(); ?>",
		      };

		    $.ajax({
		      type: "POST",
		      url: "<?php echo base_url() ?>apotik/get_klaim",
		      data: send_data,
		      cache: false,
		      dataType: 'json',
		      success: function(msg){
		        $("#nama").val(msg.nama);
		        $("#nopeserta").val(msg.nopeserta);
		        $("#alamat").val(msg.alamat);
		        $("#ttl").val(msg.ttl);
		        if (msg.stts=="ada") {
		        	document.getElementById("btn").disabled = false;
		        }else{
		        	document.getElementById("btn").disabled = true;
		        };
		      }
		    });

		    //get unit
				    $.ajax({
				        url: '<?php echo base_url() ?>apotik/get_unit/'+$("#kd_klaim").val()+'',
					    //data: send_data,
					    cache: false,
					    dataType: 'html',
				        success: function(data){
				            $('#unit').html(data);
				            $("#unit").select2({
					            placeholder: "Pilih Unit"
					        });
				        }
				    });
				    //get dokter
				    $.ajax({
				        url: '<?php echo base_url() ?>apotik/get_dokter/'+$("#kd_klaim").val()+'',
					    //data: send_data,
					    cache: false,
					    dataType: 'html',
				        success: function(data){
				            $('#dokter').html(data);
				            $("#dokter").select2({
					            placeholder: "Pilih Dokter"
					        });
				        }
				    });
		    
		  }
		  
		  

		</script>

		
		
		

		
		
		